package com.bz.controller;

import com.bz.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.Map;


/**
 * 属性注入验证
 */
@RestController
@RequestMapping("/test")
public class TestController {


    @Value("${name}")
    String name;


    @Value("${bir}")
    Date data;

    @Value("${strs}")
    String[] strs;


    @Value("#{${gege}}")
    Map<String,String> gege;


    @Autowired
    User user;

    @RequestMapping("/test")
    public String test1(){
        System.out.println("hello test");
        System.out.println(user);
        System.out.println(name);
        System.out.println(data);
        for (String str : strs) {
            System.out.println(str);
        }

        gege.forEach((k,v)-> System.out.println(k+":"+v));
        for (String s : gege.keySet()) {
            System.out.println(s);
        }
        for (String value : gege.values()) {
            System.out.println(value);
        }

        return "hello test";
    }

}
